#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>

int main()
{
    char key0[10];
    char key1[10];
    char a[10];
    int c, much = 0;

    printf("请设置初始密码\n");
    scanf("%s", key0);

    printf("密码设置成功，请输入密码\n");
    scanf("%s", key1);

    while (much < 3)
    {
        if (strcmp(key1, key0) == 0)
        {
            int choice;
            do
            {
                printf("密码输入正确\n");
                printf("请选择你要进行的操作：1-查存款  2-取钱  3-退出\n");
                scanf("%d", &choice);
                if (choice == 1)
                {
                    printf("您的余额是：9999元\n");
                }
                else if (choice == 2)
                {
                    printf("请输入您要取的数额\n");
                    scanf("%d", &c);
                    printf("正在取钱中.....%d元已取出\n", c);
                }
            } while (choice != 3);
            break;
        }
        else
        {
            printf("您输入密码有错，请重新输入密码！");
            much++;
            if (much < 3)
            {
                scanf("%s", key1);
            }
        }
    }
    if (much == 3)
    {
        printf("输入次数超过三次，卡已经冻结");
        return 1;
    }

    return 0;
}